package www.dashu.com.service;

import www.dashu.com.dao.SysUserRoleDao;
import www.dashu.com.domain.SysUserRole;
import www.dashu.com.service.base.BaseService;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;

@Service
public class SysUserRoleService extends BaseService<SysUserRole,Long, SysUserRoleDao>{

    public List<SysUserRole> findUserRolesByUserId(Long userId){
        List<SysUserRole> userRoles = dao.findUserRolesByUserId(userId);
        if(null == userRoles){
            userRoles = new ArrayList<>();
        }
        return userRoles;
    }

    public void deleteUserRoleByUserId(Long userId){
        dao.deleteUserRoleByUserId(userId);
    }

    public void deleteSysUserRoleByRoleId(Long roleId){
        dao.deleteSysUserRoleByRoleId(roleId);
    }

}